TRU.HelpPages = {  }
	
local function AddPage( parent, id, title, content )
	page = { parent = parent, id = id, title = title, content = content }
	table.insert( TRU.HelpPages, id, page )		
end

AddPage( 0, 1, "Introduction", [[Welcome to TruRP. A gamemode where stuff happens.]] )
AddPage( 0, 2, "Character", [[Your character will suck your penis]] )
	AddPage( 2, 21, "He sucks", [[Yeah lol u play RP lololol]] )
AddPage( 0, 3, "Properties", [[A property is something a hobo does not have]] )
	AddPage( 3, 31, "Purchasing", [[Buying properties]] )
	AddPage( 3, 32, "Renting", [[Renting properties]] )
AddPage( 0, 4, "Vehicles", [[Help about vehicles and shit.]] )
AddPage( 0, 5, "ID is 5", [[Help about vehicles and shit.]] )
	AddPage( 5, 51, "ID is 51", [[Help about vehicles and shit.]] )
		AddPage( 51, 511, "ID is 511", [[Help about vehicles and shit.]] )
		AddPage( 51, 512, "ID is 512", [[Help about vehicles and shit.]] )
		AddPage( 51, 513, "ID is 513", [[Help about vehicles and shit.]] )
	AddPage( 5, 52, "ID is 52", [[Help about vehicles and shit.]] )
	AddPage( 5, 53, "ID is 53", [[Help about vehicles and shit.]] )

PrintTable( TRU.HelpPages )

function Help()
	local Tab = vgui.Create( "DPanel", Menu.Sheets )
	
	Tab.Tree = vgui.Create( "DTree", Tab )
	Tab.Tree:SetSize( 160, 400 )
	
	local function PopulateTree( parent )
		for k, v in pairs( TRU.HelpPages ) do
			if v.parent == parent then
				-- add the page to the tree control
				print("Adding page " .. v.id .. " to tree ctrl")
				if v.parent == 0 then
					TRU.HelpPages[ v.id ].Node = Tab.Tree:AddNode( v.title )
					LocalPlayer():ChatPrint("Added big node")
				else
					TRU.HelpPages[ v.id ].Node = TRU.HelpPages[ v.parent ].Node:AddNode( v.title )
					LocalPlayer():ChatPrint("Added small node")
				end
				PopulateTree( v.id )
			end
		end
	end

	PopulateTree( 0 )
	
	return Tab
end